home *** CD-ROM | disk | FTP | other *** search
- on midiTest
- openXLib("midixobj")
- addLine("MIDI XObject opened")
- set windowsMIDIXObj to midixobj(mnew)
- if not objectp(windowsMIDIXObj) then
- addLine("Unable to create XObject instance - aborting")
- abort()
- end if
- set devNums to value(windowsMIDIXObj(mGetDevIDs))
- set outDevNums to getAt(devNums, 2)
- set numOutDevs to count(outDevNums)
- if numOutDevs > 0 then
- repeat with device = 1 to numOutDevs
- set outDevID to getAt(outDevNums, device)
- set outDevName to windowsMIDIXObj(mGetDevName, "OUT", outDevID)
- if windowsMIDIXObj(mOpenOut, outDevID, 1000) then
- addLine("^^^ Unable to open this device")
- next repeat
- end if
- addLine("Middle C Note On - Channel")
- repeat with loop = 0 to 15
- windowsMIDIXObj(mWrite, string(144 + loop) && "60 127")
- addStr(" " & loop)
- end repeat
- if windowsMIDIXObj(mCloseOut) then
- addLine("^^^ Problems encountered closing this device down")
- end if
- end repeat
- else
- addLine("No output devices available")
- end if
- set inDevNums to getAt(devNums, 1)
- addLine("Input device numbers:" && inDevNums)
- set numInDevs to count(inDevNums)
- if numInDevs > 0 then
- repeat with device = 1 to numInDevs
- set inDevID to getAt(inDevNums, device)
- set inDevName to windowsMIDIXObj(mGetDevName, "IN", inDevID)
- addLine("Running test for INPUT device '" & inDevName & "' (ID =" && inDevID & ")")
- if windowsMIDIXObj(mOpenIn, inDevID, 10000) then
- addLine("^^^ Unable to open this device")
- next repeat
- end if
- addLine("Incoming data:")
- startTimer()
- repeat while the timer < 120
- set inData to windowsMIDIXObj(mRead)
- if inData <> EMPTY then
- addLine(inData)
- startTimer()
- end if
- end repeat
- if windowsMIDIXObj(mCloseIn) then
- addLine("^^^ Problems encountered closing this device down")
- end if
- end repeat
- else
- addLine("No input devices available")
- end if
- windowsMIDIXObj(mdispose)
- addLine("Disposed of XObject instance")
- closeXLib("midixobj")
- addLine("MIDI XObject closed")
- addLine("* TEST COMPLETE *")
- end
-